<!DOCTYPE html>
<!-- 
  Copyright 2011 Google Inc. All Rights Reserved.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<html>
  <head>
    <title>Google Controls Editor</title>
    <style type="text/css">
      .gallery {
        font-family: sans-serif;
        font-size: 0.9em;
      }

      .control {
        margin: 1em 1em 0.5em 1em;
        padding-bottom: 0.5em;
        border-bottom: 1px dotted #ccc;
      }

      .header {
        background-color: #E5ECF9;
        border-bottom: 1px solid #36C;
        padding: 0.1em 0.3em;
        font-size: 1.2em;
        line-height: 1.3em;
        font-weight: bold;
      }
    </style>
    <script src="../../js/helper.js"></script>
    <script type='text/javascript' src='http://www.google.com/jsapi'></script>
    <script type='text/javascript'>
      google.load('visualization', '1.1',
          {packages: ['corechart', 'controls']});

      function ready() {
        // The data are unused in this demo. Just create a placeholder table.
        var data = google.visualization.arrayToDataTable([
          ['Language', 'Range'],
          ['Riccardo', 1]
        ]);

        // StringFilter instance
        var stringFilter = new google.visualization.ControlWrapper({
          'controlType': 'StringFilter',
          'dataTable': data,
          'options': {'filterColumnIndex': 0}
        });
        stringFilter.draw('stringFilter');

        // RangeFilter instances
        var horizontalRangeFilter = new google.visualization.ControlWrapper({
          'controlType': 'NumberRangeFilter',
          'dataTable': data,
          'options': {
            'filterColumnIndex': 1,
            'minValue': 0,
            'maxValue': 100,
            'ui': {
              'orientation': 'horizontal',
              'showRangeValues': true
            }
          },
          'state': {'lowValue': 10, 'highValue': 60}
        });
        horizontalRangeFilter.draw('horizontalRangeFilter');

        var verticalRangeFilter = new google.visualization.ControlWrapper({
          'controlType': 'NumberRangeFilter',
          'dataTable': data,
          'options': {
            'filterColumnIndex': 1,
            'minValue': 5000,
            'maxValue': 10000,
            'ui': {
              'orientation': 'vertical',
              'showRangeValues': true
            }
          },
          'state': {'lowValue': 6000, 'highValue': 8000}
        });
        verticalRangeFilter.draw('verticalRangeFilter');


        var labellessRangeFilter = new google.visualization.ControlWrapper({
          'controlType': 'NumberRangeFilter',
          'dataTable': data,
          'options': {
            'filterColumnIndex': 1,
            'minValue': 0,
            'maxValue': 100,
            'ui': {
              'orientation': 'horizontal',
              'showRangeValues': false,
              'label': ''
            }
          },
          'state': {'lowValue': 10, 'highValue': 60}
        });
        labellessRangeFilter.draw('labellessRangeFilter');

        // CategoryPicker instances, single selection
        var singleSelectPicker = new google.visualization.ControlWrapper({
          'controlType': 'CategoryFilter',
          'dataTable': data,
          'options': {
            'filterColumnIndex': 0,
            'values': ['Java', 'Javascript', 'C++', 'Scala', 'Erlang'],
            'ui': {
              'allowTyping': false,
              'allowMultiple': false
            }
          }
        });
        singleSelectPicker.draw('singleSelectPicker');

        var singleComboPicker = new google.visualization.ControlWrapper({
          'controlType': 'CategoryFilter',
          'dataTable': data,
          'options': {
            'filterColumnIndex': 0,
            'values': ['Java', 'Javascript', 'C++', 'Scala', 'Erlang'],
            'ui': {
              'allowTyping': true,
              'allowMultiple': false
            }
          }
        });
        singleComboPicker.draw('singleComboPicker');

        // CategoryPicker instances. Multiple selection
        var multiPickers = [
          {'container': 'multiAsideSelectPicker',
           'layout': 'aside',
           'typing': false
          },
          {'container': 'multiBelowSelectPicker',
            'layout': 'below',
            'typing': false
          },
          {'container': 'multiBelowWrappingSelectPicker',
           'layout': 'belowWrapping',
           'typing': true
          },
          {'container': 'multiBelowStackedSelectPicker',
           'layout': 'belowStacked',
           'typing': true}
        ];
        for (var i = 0; i < multiPickers.length; i++) {
          var picker = new google.visualization.ControlWrapper({
            'controlType': 'CategoryFilter',
            'dataTable': data,
            'options': {
              'filterColumnIndex': 0,
              'values': ['Java', 'Javascript', 'C++', 'Scala', 'Erlang'],
              'ui': {
                'allowTyping': multiPickers[i].typing,
                'allowMultiple': true,
                'selectedValuesLayout': multiPickers[i].layout
              }
            },
            'state': {'selectedValues': ['C++', 'Erlang', 'Javascript']}
          });
          picker.draw(multiPickers[i].container);
        }
      }

      google.setOnLoadCallback(ready);
    </script>
  </head>
  <body>
    <div class='gallery'>
      <table>
        <tr>
          <td>
            <div class='control' id='stringFilter'></div>


            <div class='control' id='horizontalRangeFilter'></div>
            <div class='control' id='verticalRangeFilter'></div>
            <div class='control' id='labellessRangeFilter'></div>
          </td>
          <td>
            <div class='control' id='singleSelectPicker'></div>
            <div class='control' id='singleComboPicker'></div>

            <div class='control' id='multiAsideSelectPicker'></div>
            <div class='control' id='multiBelowSelectPicker'></div>
            <div class='control' id='multiBelowWrappingSelectPicker'></div>
            <div class='control' id='multiBelowStackedSelectPicker'></div>
          </td>
        </tr>
      </table>
    </div>
  </body>
</html>
